Fix a problem with window dragging
authorMatthias Clasen <mclasen@redhat.com>
Sun, 16 Feb 2014 01:41:58 +0000 (20:41 -0500)
committerMatthias Clasen <mclasen@redhat.com>
Sun, 16 Feb 2014 01:41:58 +0000 (20:41 -0500)
Dragging windows was not working on widgets in the titlebar
region unless they had the window-dragging style property
set. Fix this by looking at the region for motion notify
events as well as for buton press events.

gtk/gtkwindow.c

index dd18922871077d7b46c30d7fb4744ae5ccaab246..a12e8d0c8d4e712d8149c8554c97c7787138f2ee 100644 (file)
@@ -7687,6 +7687,8 @@ gtk_window_motion_notify_event (GtkWidget      *widget,
   GtkWindowPrivate *priv = GTK_WINDOW (widget)->priv;
   GtkWidget *src;
   gboolean window_drag;
+  gint x, y;
+  GtkWindowRegion region;
 
   if (!priv->drag_possible)
     return FALSE;
@@ -7697,6 +7699,17 @@ gtk_window_motion_notify_event (GtkWidget      *widget,
       gtk_widget_style_get (GTK_WIDGET (src),
                             "window-dragging", &window_drag,
                             NULL);
+      gtk_widget_translate_coordinates (src, widget, event->x, event->y, &x, &y);
+    }
+  else
+    {
+      x = event->x;
+      y = event->y;
+    }
+
+  region = get_active_region_type (GTK_WINDOW (widget), (GdkEventAny*)event, x, y);
+  if (region == GTK_WINDOW_REGION_CONTENT)
+    {
       if (!window_drag)
         {
           priv->drag_possible = FALSE;